﻿using Dapper;
using System.Data.SqlClient;
using yunbo.Model.BIP;

namespace yunbo.Repositorys.BIPRepositorys
{
    public class Mbd_GYRepository
    {
        public string data = "Data Source=121.37.93.71;Initial Catalog=FanXingMES;User ID=sa;Password=geili@2025;";

        /// <summary>
        /// 查询工艺路线
        /// </summary>
        /// <returns></returns>
        public List<Mbd_GY> GetMbd_GY()
        {
            using (SqlConnection connection = new SqlConnection(data))
            {
                string sql = "select* from [dbo].[mbd_gy] where is_deleted=1";
                List<Mbd_GY> gy = connection.Query<Mbd_GY>(sql).ToList(); // 使用 ToList() 获取所有菜单  
                return gy;
            }
        }
        public Mbd_GY GetMbd_GY(string gy_code)
        {
            using (SqlConnection connection = new SqlConnection(data))
            {
                string sql = $"select* from [dbo].[mbd_gy] where gy_code='{gy_code}'";
                Mbd_GY gy = connection.Query<Mbd_GY>(sql).FirstOrDefault(); // 使用 ToList() 获取所有菜单  
                return gy;
            }
        }
    }
}
